package com.warm.base.jdk.thread.realize;

/**
 * @Date: 2020/4/2 9:14
 * @Author: LChuang
 * @Description:
 */
public class Client {

    public static void main(String[] args) {
        SingleThread singleThread = new SingleThread(10, "hello world");
        System.out.println(Thread.currentThread().getName()  + " : Single Thread Copy Starting...");
        singleThread.copy();
        System.out.println(Thread.currentThread().getName()  + " : Single Thread Copy Ending...");

        ExtendsThread extendsThread = new ExtendsThread("extend", 10, "hello world");
        System.out.println(Thread.currentThread().getName()  + " : Extends Thread Copy Starting...");
        // 继承 Thread 实现独立线程单词抄写, ExtendsThread 构造方法里可以调用 super(name) --> 自己定义线程名
        extendsThread.start();
        System.out.println(Thread.currentThread().getName()  + " : Extends Thread Copy Ending...");

        ImplementsRunnable implementsRunnable = new ImplementsRunnable("implement", 10, "hello world");
        System.out.println(Thread.currentThread().getName()  + " : Implement Thread Copy Starting...");
        // 实现 Runnable 接口，启用单独线程抄写单词
        Thread implementThread = new Thread(implementsRunnable);
        implementThread.start();
        System.out.println(Thread.currentThread().getName()  + " : Implement Thread Copy Ending...");
    }
}
